package club.caihappy.jedis;

import redis.clients.jedis.Jedis;

import java.util.Set;

/**
 * Created by DELL on 2021/12/1
 **/
public class JedisDemo1 {
    public static void main(String[] args) {
        //创建Jedis对象
        Jedis jedis = new Jedis("101.43.5.132", 6379);
        jedis.auth("123");
        jedis.set("name", "lucy");
        System.out.println(jedis.get("name"));
        jedis.mset("k1", "v1", "k2", "v2");
        System.out.println(jedis.mget("k1", "k2"));
        String ping = jedis.ping();
        System.out.println(ping);
//        new JedisDemo1().demo1(jedis);
        jedis.close();
    }

    public void demo1(Jedis jedis) {
        Set<String> keys = jedis.keys("*");
        for (String key : keys) {
            System.out.println(key);
        }
    }
}
